﻿<html>
<title>Чатик - Администрирование</title>
<body>
<table width = "100%" bordercolor = "green"><!-- \"#5a009c\" -->
<?php
session_start();
include 'interface.php';
include 'dbconnect.php';
$dbcnx = dbconnect();
drawHeader();

$query = "SELECT record.caption, user.name, record.date, record.id FROM newsdb.records record, newsdb.users user WHERE (record.author_id = user.id) ORDER BY record.date DESC";
$news = mysql_query($query);

$rownum = mysql_num_rows($news);
echo "<table width = \"100%\" bordercolor = \"green\" cellpadding=\"1\" bgcolor = \"black\">";
for ($i = 0; $i < $rownum; $i++)
{
    echo "<tr>";

    echo "<td bgcolor = \"white\">";
    echo $i + 1;
    echo "</td>";

    echo "<td bgcolor = \"white\">";
    echo mysql_result($news, $i, 'caption');
    echo "</td>";

    echo "<td bgcolor = \"white\">";
    echo mysql_result($news, $i, 'name');
    echo "</td>";

    echo "<td bgcolor = \"white\">";
    echo mysql_result($news, $i, 'date');
    echo "</td>";

    echo "<td bgcolor = \"white\">";
    echo "<form action=\"delete_record.php\" method=\"post\">";
    echo "<input name=\"id_deleted\" value=\"";
    echo mysql_result($news, $i, 'id');
    echo "\" type=\"hidden\" />";
    echo "<input type=\"submit\" value=\"Delete\" />";
    echo "</td>";

    echo "</tr>";
}
echo "</table>";

?>

</table>


</body>
</html>